package com.bazaaroid.server.gae.core.dto.partner;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import com.bazaaroid.server.gae.core.persistence.model.partner.Product;

@XmlRootElement(name = "ProductSearchResults")
public class ProductSearchResultsDTO {

	private List<Product> products = null;

	public ProductSearchResultsDTO() {}

	public ProductSearchResultsDTO(List<Product> products) {
		this.products = products;
	}

	@XmlElement(name = "product")
	@XmlElementWrapper(name = "products")
	public List<ProductDTO> getProducts() {
		List<ProductDTO> productsDTO = new ArrayList<ProductDTO>();
		for(Product product: products)
			productsDTO.add(new ProductDTO(product));

		return productsDTO;
	}
}
